FROM ubuntu:18.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get -y upgrade
RUN apt install -y git ssh make gcc libssl-dev \
      liblz4-tool u-boot-tools curl expect g++ patchelf chrpath gawk \
      texinfo chrpath diffstat binfmt-support qemu-user-static live-build \
      bison flex fakeroot cmake gcc-multilib g++-multilib unzip \
      device-tree-compiler python3-pip libncurses5-dev python3-pyelftools \
      dpkg-dev vim

RUN mkdir ~/bin 
RUN curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
# 如果上面的地址无法访问，可以用下面的：
# curl -sSL  'https://gerrit-googlesource.proxy.ustclug.org/git-repo/+/master/repo?format=TEXT' |base64 -d > ~/bin/repo
RUN chmod a+x ~/bin/repo && echo PATH=~/bin:$PATH >> ~/.bashrc && source ~/.bashrc

# Additional host packages required by poky/scripts/wic
RUN apt-get install -y curl dosfstools mtools parted syslinux tree zip

RUN  ln -sf /usr/bin/python3 /usr/bin/python

# Create a non-root user that will perform the actual build
RUN id build 2>/dev/null || useradd --uid 30000 --create-home build
RUN apt-get install -y sudo
RUN echo "build ALL=(ALL) NOPASSWD: ALL" | tee -a /etc/sudoers

# Fix error "Please use a locale setting which supports utf-8."
# See https://wiki.yoctoproject.org/wiki/TipsAndTricks/ResolvingLocaleIssues
RUN apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
        echo 'LANG="en_US.UTF-8"'>/etc/default/locale && \
        dpkg-reconfigure --frontend=noninteractive locales && \
        update-locale LANG=en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8



USER build
WORKDIR /home/build
CMD "/bin/bash"



#EOF
